package top.system.dept;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import top.system.dept.mapper.UserMapper;
import top.system.dept.pojo.Dept;
import top.system.dept.pojo.User;
import top.system.dept.utils.SecurityUtil;

@SpringBootApplication
@MapperScan(basePackages = { "top.system.dept.mapper" })
@EnableTransactionManagement
@ServletComponentScan
public class DeptSysApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(DeptSysApplication.class, args);

		boolean test = false;

		if (test) {
			UserMapper userMapper = context.getBean("userMapper", UserMapper.class);

			User user = new User();
			user.setAccount("20198591");
			user.setPassword(SecurityUtil.encrypt32ForMD5("root"));
			user.setAuth(0);
			user.setDescription("生活部主要负责人");
			user.setDept(new Dept(1, "生活部"));
			userMapper.addUser(user);
		}


	}

}
